<template>
  <div>
    <nav>
        <span @click="curr = 'you'">You</span> |
        <span @click="curr = 'me'">Me</span>
    </nav>
    <!-- 动态组件一样可以缓存 -->
    <keep-alive>
        <component :is="curr"></component>
    </keep-alive>
  </div>
</template>

<script>
import you from "./keepalivedemo/You.vue"
import me from "./keepalivedemo/Me.vue"
export default {
    components:{
        you,
        me
    },
    data(){
        return{
            curr : "you"
        }
    }
}
</script>

<style>

</style>